//=============================
// Filename: vector2f.h
//=============================
#ifndef _VECTOR2F_H
#define _VECTOR2F_H

//
//
//
#include <math.h>

//
//
//
#define PI 3.14159265

//=====================
// Class: Vector2f
//=====================
class Vector2f {

public:
	Vector2f() {X = 0; Y = 0;}
	Vector2f(const Vector2f& v) {X =v.X; Y = v.Y;}

	Vector2f(float x, float y) {X = x; Y = y;}

	~Vector2f(){}

	void Normalise(float length) {
		float l = GetLength();

		if(l != 0.0f) {
			X = X / l * length;
			Y = Y / l * length;
		}
	}

	float GetLength() {
		return sqrt(X*X + Y*Y);
	}

	void Rotate(float a) {
		float angle, c, s;
		float x, y;

		angle = a * (float)PI / 180.0f;
		c = cos(angle);
		s = sin(angle);

		x = X * c - Y * s;
		y = X * c + Y * s;

		X = x;
		Y = y;
	}

public:
	float X, Y;
};

#endif
